<!doctype html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  <title>我的钱包</title>
  <link rel="stylesheet" type="text/css" href="../css/api.css" />
  <link rel="stylesheet" type="text/css" href="../css/my.css" />
</head>

<body>
  <div id="app" v-cloak>
    <div class="wrap flex-wrap flex-vertical">
      <header id="header">
        <div class="header-wrap border-bottom">
          <div class="header-left" onclick="api.closeWin()">
            <i class="iconfont icon-pre"></i>
          </div>
          <div class="header-title">我的钱包</div>
        </div>
      </header>
      <div class="flex-con">
        <div class="wallet-content">
          <div class="balance">
            <i class="icon icon-gold"></i>
            <span>{{info.gold}}</span>
          </div>
          <div class="wallet-button border-bottom">
            <button @click='openRecharge'>充值</button>
            <button @click='openWithdraw'>提现</button>
          </div>
        </div>
        <div class="menu-list">
          <div @click="openIncome" class="menu-item border-bottom">
            <i class="iconfont icon-shouru1"></i>
            <div class="menu-info">
              <div class="title">收入明细</div>
            </div>
            <i class="iconfont icon-next"></i>
          </div>
          <div @click="openExpenditure" class="menu-item border-bottom">
            <i class="iconfont icon-xiaofeijilu"></i>
            <div class="menu-info">
              <div class="title">消费明细</div>
            </div>
            <i class="iconfont icon-next"></i>
          </div>
          <div @click='openMygift' class="menu-item border-bottom">
            <i class="iconfont icon-liwu"></i>
            <div class="menu-info">
              <div class="title">我的礼物</div>
            </div>
            <i class="iconfont icon-next"></i>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>

</html>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/vue.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript">
  var app;
  apiready = function () {
    $api.fixStatusBar($api.dom('#header'));
    app = new Vue({
      el: '#app',
      data: {
        info: {},
      },
      created: function () {
        var _this = this;
        _this.info = api.pageParam;
      },
      mounted: function () {
        var _this = this;
        _this.getUserIndex();
      },
      methods: {
        openRecharge: function () {
          api.openWin({
            name: 'recharge',
            url: 'recharge.html',
            bounces: false,
            pageParam: this.info
          });
        },
        openWithdraw: function () {
          api.openWin({
            name: 'withdraw',
            url: 'withdraw.html',
            bounces: false,
            pageParam: this.info
          });
        },
        openIncome: function () {
          api.openWin({
            name: 'income',
            url: 'income.html',
            bounces: false,
            pageParam: this.info
          });
        },
        openExpenditure: function () {
          api.openWin({
            name: 'my_expenditure',
            url: 'my_expenditure.html',
            bounces: false,
            pageParam: this.info
          });
        },
        openMygift: function () {
          api.openWin({
            name: 'my_gift',
            url: 'my_gift.html',
            bounces: false,
            pageParam: this.info
          });
        },
        getUserIndex: function () {
          var _this = this;
          // api.showProgress({
          //   title: '',
          //   text: ''
          // });
          api.ajax({
            url: baseUrl + 'user/index',
            method: 'get',
            headers: {
              token: $api.getStorage('deviceToken')
            },
            data: {
              values: {
                uid: $api.getStorage('uid'),
              },
            }
          }, function (ret, err) {
            // api.refreshHeaderLoadDone();
            // api.hideProgress();
            if (ret.status == '200') {
              _this.info = ret.data;
            }
          })
        },
      },
      filters: {}
    })
  }
</script>